import 'package:aero_frisbee/app/store/app_store.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'app/state/app_cache_state.dart';
import 'entry_app.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final sharedPreferences = await SharedPreferences.getInstance();
  moduleConfig(sharedPreferences);

  runApp(ProviderScope(
    overrides: [
      appPrefsProvider.overrideWithValue(sharedPreferences),
    ],

    child: const EntryApp(),
    // child: const RootApp(),
  ));
}

moduleConfig(SharedPreferences sharedPreferences) {
  //注册全局
  GetIt.instance.registerSingleton<AppStore>(AppStore(sharedPreferences));
}
